package com.senlingspace.web.controller.registry;

import com.senlingspace.common.annotation.Log;
import com.senlingspace.common.core.controller.BaseController;
import com.senlingspace.common.core.domain.AjaxResult;
import com.senlingspace.common.core.page.TableDataInfo;
import com.senlingspace.common.enums.BusinessType;
import com.senlingspace.system.domain.SlkTeamStatus;
import com.senlingspace.system.domain.dto.TeamStatusDto;
import com.senlingspace.system.service.ISlkTeamStatusService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 门店组队信息Controller
 * 
 * @author SenlingSpace
 * @date 2024-08-19
 */
@RestController
@RequestMapping("/registry/status")
public class TeamStaRegistryController extends BaseController
{
    @Autowired
    private ISlkTeamStatusService slkTeamStatusService;

    /**
     * 测试初始化数据接口
     */
    @GetMapping("/init")
    public AjaxResult initByShopId( Long shopId,Long number)
    {
        return toAjax(slkTeamStatusService.initByShopId(shopId,number));
    }



    /**
     *修改门店一个组队的信息为正在使用
     */
    @Log(title = "门店组队信息", businessType = BusinessType.UPDATE)
    @PutMapping("/updateByInit")
    public AjaxResult updateByInit(Long shopId)
    {
        TeamStatusDto statusDtos = slkTeamStatusService.updateByStatusByInit(shopId);
        return success(statusDtos);
    }

    /**
     * 查询门店正在使用的组队信息列表
     */
    @GetMapping("/listByIntend")
    public TableDataInfo listByIntend(Long shopId)
    {
        List<TeamStatusDto> list = slkTeamStatusService.listByIntend(shopId);
        return getDataTable(list);
    }

    /**
     * 修改门店组队信息
     */
    @PreAuthorize("@ss.hasPermi('system:status:edit')")
    @Log(title = "门店组队信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SlkTeamStatus slkTeamStatus)
    {
        return toAjax(slkTeamStatusService.updateSlkTeamStatus(slkTeamStatus));
    }


    //
//    /**
//     * 查询门店组队信息列表
//     */
//    @GetMapping("/list")
//    public TableDataInfo list(SlkTeamStatus slkTeamStatus)
//    {
//        startPage();
//        List<TeamStatusDto> list = slkTeamStatusService.selectSlkTeamStatusList(slkTeamStatus);
//        return getDataTable(list);
//    }



//    /**
//          * 新增门店组队信息
//          */
//    @PreAuthorize("@ss.hasPermi('system:status:add')")
//    @Log(title = "门店组队信息", businessType = BusinessType.INSERT)
//    @PostMapping
//    public AjaxResult add(@RequestBody SlkTeamStatus slkTeamStatus)
//    {
//        return toAjax(slkTeamStatusService.insertSlkTeamStatus(slkTeamStatus));
//    }
//
//
//    /**
//     * 删除门店组队信息
//     */
//    @PreAuthorize("@ss.hasPermi('system:status:remove')")
//    @Log(title = "门店组队信息", businessType = BusinessType.DELETE)
//	@DeleteMapping("/{teamIds}")
//    public AjaxResult remove(@PathVariable Long[] teamIds)
//    {
//        return toAjax(slkTeamStatusService.deleteSlkTeamStatusByIds(teamIds));
//    }





//    /**
//     * 导出门店组队信息列表
//     */
//    @PreAuthorize("@ss.hasPermi('system:status:export')")
//    @Log(title = "门店组队信息", businessType = BusinessType.EXPORT)
//    @PostMapping("/export")
//    public void export(HttpServletResponse response, SlkTeamStatus slkTeamStatus)
//    {
//        List<SlkTeamStatus> list = slkTeamStatusService.selectSlkTeamStatusList(slkTeamStatus);
//        ExcelUtil<SlkTeamStatus> util = new ExcelUtil<SlkTeamStatus>(SlkTeamStatus.class);
//        util.exportExcel(response, list, "门店组队信息数据");
//    }

//    /**
//     * 获取门店组队信息详细信息
//     */
//    @PreAuthorize("@ss.hasPermi('system:status:query')")
//    @GetMapping(value = "/{id}")
//    public AjaxResult getInfo(@PathVariable("id") Long id)
//    {
//        return success(slkTeamStatusService.selectSlkTeamStatusById(id));
//    }


}
